#include <iostream>
using namespace std;

int arr[5000001];
int main()
{
	int n;
	cin >> n;
	int key;
	cin >> key;
	for(int i = 1; i <= n; i++)
	{
		cin >> arr[i]; 
	} 
	int left = 1;
	int right = n;
	int mid = (left + right)/2;
	
	while(left <= right)
	{
		if(arr[mid] < key)
		{
			left = mid + 1;
			mid = (left + right)/2;
		}
		else if(arr[mid] > key)
		{
			right = mid - 1;
			mid = (left + right)/2;
		}
		else
		{
			cout << mid << endl;
			return 0;
		}
	}
	cout << "-1" << endl;
	return 0;
}
